using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace WIT.DAQ.Core.Forms;

/// <summary>
///
/// </summary>
internal class LogSettingForm : Form
{
	/// <summary>
	///
	/// </summary>
	/// <param name="showTaskDuration">是否显示任务执行时长</param>
	/// <param name="filterDuration">是否过滤任务执行时长</param>
	/// <param name="duration">过滤条件-执行时长</param>
	internal delegate void SaveLogSettingHandler(bool showTaskDuration, bool filterDuration, decimal duration);

	/// <summary>
	/// Required designer variable.
	/// </summary>
	private IContainer components = null;

	private Label label4;

	private Button btnConfirm;

	private Button btnCancel;

	private CheckBox cbShowTaskDuration;

	private NumericUpDown nudDuration;

	private CheckBox cbFilterDuration;

	/// <summary>
	///
	/// </summary>
	internal event SaveLogSettingHandler SaveLogSetting;

	/// <summary>
	///
	/// </summary>
	/// <param name="showTaskDuration">是否显示任务执行时长</param>
	/// <param name="filterDuration">是否过滤任务执行时长</param>
	/// <param name="duration">过滤条件-执行时长</param>
	internal LogSettingForm(bool showTaskDuration, bool filterDuration, decimal duration)
	{
		InitializeComponent();
		cbShowTaskDuration.Checked = showTaskDuration;
		cbFilterDuration.Checked = filterDuration;
		nudDuration.Value = duration;
	}

	private void btnConfirm_Click(object sender, EventArgs e)
	{
		this.SaveLogSetting(cbShowTaskDuration.Checked, cbFilterDuration.Checked, nudDuration.Value);
		Close();
	}

	private void btnCancel_Click(object sender, EventArgs e)
	{
		Close();
	}

	/// <summary>
	/// Clean up any resources being used.
	/// </summary>
	/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	/// <summary>
	/// Required method for Designer support - do not modify
	/// the contents of this method with the code editor.
	/// </summary>
	private void InitializeComponent()
	{
		this.label4 = new System.Windows.Forms.Label();
		this.btnConfirm = new System.Windows.Forms.Button();
		this.btnCancel = new System.Windows.Forms.Button();
		this.cbShowTaskDuration = new System.Windows.Forms.CheckBox();
		this.nudDuration = new System.Windows.Forms.NumericUpDown();
		this.cbFilterDuration = new System.Windows.Forms.CheckBox();
		((System.ComponentModel.ISupportInitialize)this.nudDuration).BeginInit();
		base.SuspendLayout();
		this.label4.AutoSize = true;
		this.label4.Location = new System.Drawing.Point(182, 63);
		this.label4.Name = "label4";
		this.label4.Size = new System.Drawing.Size(71, 12);
		this.label4.TabIndex = 4;
		this.label4.Text = "s的任务日志";
		this.btnConfirm.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
		this.btnConfirm.Location = new System.Drawing.Point(275, 105);
		this.btnConfirm.Name = "btnConfirm";
		this.btnConfirm.Size = new System.Drawing.Size(75, 23);
		this.btnConfirm.TabIndex = 1;
		this.btnConfirm.Text = "确认(&S)";
		this.btnConfirm.UseVisualStyleBackColor = true;
		this.btnConfirm.Click += new System.EventHandler(btnConfirm_Click);
		this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
		this.btnCancel.Location = new System.Drawing.Point(356, 105);
		this.btnCancel.Name = "btnCancel";
		this.btnCancel.Size = new System.Drawing.Size(75, 23);
		this.btnCancel.TabIndex = 2;
		this.btnCancel.Text = "取消(&C)";
		this.btnCancel.UseVisualStyleBackColor = true;
		this.btnCancel.Click += new System.EventHandler(btnCancel_Click);
		this.cbShowTaskDuration.AutoSize = true;
		this.cbShowTaskDuration.Location = new System.Drawing.Point(24, 29);
		this.cbShowTaskDuration.Name = "cbShowTaskDuration";
		this.cbShowTaskDuration.Size = new System.Drawing.Size(120, 16);
		this.cbShowTaskDuration.TabIndex = 12;
		this.cbShowTaskDuration.Text = "显示任务执行时长";
		this.cbShowTaskDuration.UseVisualStyleBackColor = true;
		this.nudDuration.Location = new System.Drawing.Point(144, 57);
		this.nudDuration.Name = "nudDuration";
		this.nudDuration.Size = new System.Drawing.Size(35, 21);
		this.nudDuration.TabIndex = 17;
		this.nudDuration.Value = new decimal(new int[4] { 32, 0, 0, 65536 });
		this.cbFilterDuration.AutoSize = true;
		this.cbFilterDuration.Location = new System.Drawing.Point(24, 62);
		this.cbFilterDuration.Name = "cbFilterDuration";
		this.cbFilterDuration.Size = new System.Drawing.Size(120, 16);
		this.cbFilterDuration.TabIndex = 18;
		this.cbFilterDuration.Text = "仅查询执行时长≥";
		this.cbFilterDuration.UseVisualStyleBackColor = true;
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(443, 140);
		base.Controls.Add(this.cbFilterDuration);
		base.Controls.Add(this.nudDuration);
		base.Controls.Add(this.cbShowTaskDuration);
		base.Controls.Add(this.btnConfirm);
		base.Controls.Add(this.btnCancel);
		base.Controls.Add(this.label4);
		base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
		base.KeyPreview = true;
		base.MaximizeBox = false;
		base.Name = "LogSettingForm";
		base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
		this.Text = "日志查询-配置";
		((System.ComponentModel.ISupportInitialize)this.nudDuration).EndInit();
		base.ResumeLayout(false);
		base.PerformLayout();
	}
}
